import { Navigate, RouteObject } from 'react-router-dom'

import Login from '@/views/Login'
import Err404 from '@/views/404'
import Layout from '@/views/Layout'
// 数据和文档(@/src/Common)
import Home from '@/views/Layout/Common/Home'
import Document from '@/views/Layout/Common/Document'
// 系统管理(@/src/Global)
import User from '@/views/Layout/Global/User'
import Group from '@/views/Layout/Global/Group'
// 用户权限管理(@/src/Auth)
import Auth from '@/views/Layout/Auth'

const routes: RouteObject[] = [
  {
    path: '/login',
    element: <Login />
  },
  {
    path: '/',
    element: <Layout />,
    children: [
      // 数据和文档(@/src/Common)
      {
        index: true,
        element: <Home />
      },
      {
        path: 'document/:type',
        element: <Document />
      },
      // 系统管理(@/src/Global)
      {
        path: 'user',
        element: <User />
      },
      {
        path: 'group',
        element: <Group />
      },
      // 用户权限管理(@/src/Auth)
      {
        path: 'auth',
        element: <Auth />
      }
    ]
  },
  {
    path: '/404',
    element: <Err404 />
  },
  {
    path: '*',
    element: <Navigate to='/404' />
  }
]

export default routes
